package cn.zl.api.dto.user;

import cn.yunbamboos.rest.service.anno.param.ParamType;
import cn.yunbamboos.rest.service.anno.param.enums.Type;
import cn.yunbamboos.rest.service.dto.in.GenericInDTO;
import cn.zl.model.User;
import com.alibaba.fastjson2.JSONObject;
import jakarta.validation.constraints.NotNull;

public class AddUserInDTO extends GenericInDTO {

    @NotNull(message = "用户信息不能为空")
    @ParamType(path = "user", type = Type.Object, title = "用户信息", required = true)
    private User user;

    @Override
    public void decode(JSONObject json) {
        super.decode(json);
        this.user = this.getModel(json, "user", User.class);
    }

    public User getUser() {
        return user;
    }
}
